package com.zy.business.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * @Description
 * @Author  zhangxiaojia
 * @Date 2020-07-16
 */

@Data
@ApiModel
@TableName("tb_punch_card" )
public class TbPunchCard  implements Serializable, Comparable {

	private static final long serialVersionUID =  1834667835568850222L;

	/**
	 * 主键
	 */
   	 @TableId(value="id")
	private Long id;

	/**
	 * 部门id
	 */
   	 @TableField("dept_id" )
	 @ApiModelProperty(value ="部门id")
	private Long deptId;

	/**
	 * 人员id
	 */
   	 @TableField("user_id" )
	 @ApiModelProperty(value ="人员id")
	private Long userId;

	/**
	 * 人员id
	 */
	@TableField("ding_user_id" )
	@ApiModelProperty(value ="钉钉考勤用户id")
	private String dingUserId;

	/**
	 * 人员name
	 */
	@TableField(exist = false)
	@ApiModelProperty(value ="人员name")
   	private String name;

	/**
	 * 头像
	 */
	@TableField(exist = false)
	private String headImg;

	/**
	 * 微信唯一标识
	 */
	@TableField(exist = false)
	private String openId;

	/**
	 * 出勤率
	 */
	@TableField(exist = false)
	private String attendance;

	/**
	 * 打卡时间
	 */
   	 @TableField("punch_card_time" )
	 @ApiModelProperty(value ="打卡时间")
	 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	private Date punchCardTime;

	/**
	 * 状态(0:未打卡1:缺卡2:迟到3:请假4:正常)
	 */
   	 @TableField("status" )
	 @ApiModelProperty(value ="状态(0:未打卡1:缺卡2:迟到3:请假4:正常)")
	private Integer status;

	/**
	 * 考勤类别(1上午上班2上午下班3下午上班4下午下班)
	 */
	@TableField("state" )
	@ApiModelProperty(value ="考勤类别")
	private Integer state;

	/**
	 * 创建时间
	 */
   	 @TableField("CREATE_TIME" )
	 @ApiModelProperty(value ="创建时间")
	 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	private Date createTime;

	@TableField(exist = false)
	@ApiModelProperty(value ="姓名")
   	 private String userName;

	/**
	 * 更新时间
	 */
   	 @TableField("UPDATE_TIME" )
	 @ApiModelProperty(value ="更新时间")
	 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	private Date updateTime;

	@TableField(exist = false)
	@ApiModelProperty(value ="打卡地点")
	private String address;

	@TableField(exist = false)
	@ApiModelProperty(value ="打卡类型")
	private String punchCardType;

	@TableField("attendance_id")
	private Long attendanceId;

	@Override
	public int compareTo(Object o) {
		if (o instanceof TbPunchCard){
			return this.punchCardTime.compareTo(((TbPunchCard) o).getPunchCardTime());
		}
		return 1;
	}
}
